%CHOOSLL  calls up a window for estimation of optimal bandwidth for
%         local - linear estimator
%
%     Use only in procedure KERN
%
% (C) Jan Kolacek, Masaryk University (Czech Republic)

if ~exist('Inmat','var')
   Inmat=zeros(12,4);Inp=Inmat;
else
   Inmat(:,2)=0;Inp=Inmat;
end;
bcgcol=[.8529 .8529 .8529];
tw=0.08;
editFig=findobj(0,'name','EDIT');
hndlList=get(editFig,'UserData');   
hHndl=hndlList(4);
llstr='Choosing the optimal bandwidth for the local - linear estimator';
callstr=['sez=findobj(gcf,''style'',''radiobutton'');set(sez,''Value'',0);set(gco,''Value'',1);',...
    'tg=get(gco,''Tag'');vedle=findobj(gcf,''Tag'',tg(1:end-3));actual=get(vedle,''string'');hpom=actual(2,5:end);',...
    'set(acth,''String'',hpom);set(hHndl,''String'',hpom);h=str2num(hpom);save v.mat h -append;'];

uicontrol( ...
     	  'Style','text', ...
        'Units','normalized', ...
        'Position',[0.15,hor-.15,.7,.13], ...
        'ForegroundColor','blue', ...
        'BackgroundColor',[.7 .7 .7], ...
        'FontSize',13,...
        'FontUnits','normalized',...
        'String',llstr);
     
 uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',[vert-.01,hor-16*vys-.03,.55,.67], ...
        'BackgroundColor',bcgcol);
     
 uicontrol( ...
     	  'Style','text', ...
        'Units','normalized', ...
        'Position',[vert,hor-4*vys-.02,.53,.05], ...
        'BackgroundColor',bcgcol,...
        'FontSize',12,...
        'FontUnits','normalized',...
        'String','Penalizing functions');
%        'ForegroundColor',[0.6 .9 0.9], ...
     
%generalized cross-validation    
 uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.27,hor-12*vys-.05,.13,.05], ...
         'BackgroundColor',[.5,0.5,0.5], ...
         'Callback',['set(llgcv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhg2,gcv2,gtr2]=gcvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llgcv,''String'',CH);Inmat(1,2)=1;Inp(1,2)=1;',...
         'set(llgcvz,''Enable'',''on'');set(llgcvset,''Visible'',''on'');'],...   
         'String','Generaliz. CV');
         
llgcv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135+.27,hor-13*vys-.05,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llgcv',...
   'String','');
            
llgcvz=uicontrol('Style','push','Units','normalized', ...
   'FontUnits','normalized',...
          'Position',[vert+.27,hor-13*vys-.05,.13,.05], ...
          'Callback',['figure;plot(hhg2,gcv2,''r'');',...
          'title(''GCV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       

llgcvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215+.27,hor-13*vys-.05,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llgcvset',...
   'String','');
      
%Classic cross-validation       
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert,hor-6*vys-.02,.13,.05], ...
         'Callback',['set(llcv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhcv2,cv2]=cvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llcv,''String'',CH);Inmat(11,2)=1;Inp(11,2)=1;',...
         'set(llcvz,''Enable'',''on'');set(llcvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'ForegroundColor',[.6,0.2,0.2], ...
         'String','Classic CV');
         
llcv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135,hor-7*vys-.02,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llcv',...
   'String','');
            
llcvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert,hor-7*vys-.02,.13,.05], ...
          'Callback',['figure;plot(hhcv2,cv2,''r'');',...
          'title(''Classic CV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'ForegroundColor',[.6,0.2,0.2], ...
          'String','draw',...
          'Enable','off');       
       
llcvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215,hor-7*vys-.02,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llcvset',...
   'String','');
       
%Akaike       
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.27,hor-8*vys-.03,.13,.05], ...
         'Callback',['set(llacv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hha2,acv2,atr2]=acvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llacv,''String'',CH);Inmat(2,2)=1;Inp(2,2)=1;',...
         'set(llacvz,''Enable'',''on'');set(llacvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Akaike CV');
         
llacv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135+.27,hor-9*vys-.03,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llacv',...
   'String','');
            
llacvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert+.27,hor-9*vys-.03,.13,.05], ...
          'Callback',['figure;plot(hha2,acv2,''r'');',...
          'title(''Akaike CV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
      
llacvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215+.27,hor-9*vys-.03,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llacvset',...
   'String','');
      
%Finite prediciton       
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.27,hor-6*vys-.02,.13,.05], ...
         'Callback',['set(llfpecv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhfp2,fpcv2,fptr2]=fpecvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llfpecv,''String'',CH);Inmat(3,2)=1;Inp(3,2)=1;',...
         'set(llfpecvz,''Enable'',''on'');set(llfpecvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Fin. pred. CV');
         
llfpecv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135+.27,hor-7*vys-.02,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llfpecv',...
   'String','');
            
llfpecvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert+.27,hor-7*vys-.02,.13,.05], ...
          'Callback',['figure;plot(hhfp2,fpcv2,''r'');',...
          'title(''FPECV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
      
llfpecvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215+.27,hor-7*vys-.02,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llfpecvset',...
   'String','');
      
%Shibata
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert,hor-8*vys-.03,.13,.05], ...
         'Callback',['set(llscv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhs2,scv2,str2]=scvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llscv,''String'',CH);Inmat(4,2)=1;Inp(4,2)=1;',...
         'set(llscvz,''Enable'',''on'');set(llscvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Shibata CV');
         
llscv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135,hor-9*vys-.03,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llscv',...
   'String','');
            
llscvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert,hor-9*vys-.03,.13,.05], ...
          'Callback',['figure;plot(hhs2,scv2,''r'');',...
          'title(''SCV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
      
llscvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215,hor-9*vys-.03,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llscvset',...
   'String','');

%Rice     
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert,hor-10*vys-.04,.13,.05], ...
         'Callback',['set(llrcv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhr2,rcv2,rtr2]=rcvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llrcv,''String'',CH);Inmat(5,2)=1;Inp(5,2)=1;',...
         'set(llrcvz,''Enable'',''on'');set(llrcvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Rice CV');
         
llrcv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135,hor-11*vys-.04,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llrcv',...
   'String','');
            
llrcvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert,hor-11*vys-.04,.13,.05], ...
          'Callback',['figure;plot(hhr2,rcv2,''r'');',...
          'title(''RCV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
      
llrcvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215,hor-11*vys-.04,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llrcvset',...
   'String','');
      
%Full       
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert,hor-12*vys-.05,.13,.05], ...
         'Callback',['set(llfcv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhf2,fcv2,ftr2]=fcvll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llfcv,''String'',CH);Inmat(6,2)=1;Inp(6,2)=1;',...
         'set(llfcvz,''Enable'',''on'');set(llfcvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Full CV');
         
llfcv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.135,hor-13*vys-.05,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llfcv',...
   'String','');
            
llfcvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert,hor-13*vys-.05,.13,.05], ...
          'Callback',['figure;plot(hhf2,fcv2,''r'');',...
          'title(''FCV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
      
llfcvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215,hor-13*vys-.05,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llfcvset',...
   'String','');

%Moje       
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.27,hor-10*vys-.04,.13,.05], ...
         'Callback',['set(llkcv,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhk2,kcv2,ktr2]=kll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llkcv,''String'',CH);Inmat(7,2)=1;Inp(7,2)=1;',...
         'set(llkcvz,''Enable'',''on'');set(llkcvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Kolacek CV');
         
llkcv=uicontrol( ...
	'Style','text', ...
   'BackgroundColor',bcgcol,...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'Position',[vert+.135+.27,hor-11*vys-.04,tw,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llkcv',...
   'String','');
            
llkcvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert+.27,hor-11*vys-.04,.13,.05], ...
          'Callback',['figure;plot(hhk2,kcv2,''r'');',...
          'title(''KCV dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
       
llkcvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.215+.27,hor-11*vys-.04,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llkcvset',...
   'String','');
      
% Ostatni       
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.26,hor-18*vys-.04,.28,.07], ...
         'Callback','Inmat=Inp;drallll;',...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Draw all error functions');

uicontrol('Style','text','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.55,hor-18*vys-.06,.08,.07], ...
         'BackgroundColor',[.7 .7 .7],...
         'String','Actual h:');
     
acth=uicontrol('Style','text','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.63,hor-18*vys-.06,.08,.07], ...
         'HorizontalAlignment','left',...
         'BackgroundColor',[.7 .7 .7],...
         'String','none');
     
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.1,hor-16*vys,.3,.07], ...
         'Callback','Inmat=Inp;drallpenll;',...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Draw all penalizing functions');
      
%Odhsig frame
uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert,hor-17*vys-.04,.13,.05], ...
         'Callback',['set(llsig,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhsig2,sigcv2]=sigll(x,y,n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llsig,''String'',CH);Inmat(9,2)=1;Inp(9,2)=1;',...
         'set(llsigz,''Enable'',''on'');set(llsigset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Mallows');
         
llsig=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'Position',[vert+.135,hor-18*vys-.04,tw,.08], ...
   'HorizontalAlignment','left',...
   'BackgroundColor',[.7 .7 .7],...
   'Tag','llsig',...
   'String','');
            
llsigz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert,hor-18*vys-.04,.13,.05], ...
          'Callback',['figure;plot(hhsig2,sigcv2,''r'');',...
          'title(''Mallows dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       

llsigset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',[.7 .7 .7],...
   'Position',[vert+.215,hor-18*vys-.04,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llsigset',...
   'String','');
      
%Chiu frame      
uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',[vert+.55,hor-10*vys+.01+.09,.39,.24], ...
        'BackgroundColor',bcgcol);
     
uicontrol( ...
     	  'Style','text', ...
        'Units','normalized', ...
        'BackgroundColor',bcgcol,...
        'Position',[vert+.56,hor-4*vys-.005,.37,.04], ...
        'FontSize',12,...
        'FontUnits','normalized',...
        'String','Fourier');
     
 % First, the MiniCommand Window frame
    
    uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',[vert+.6,hor-6*vys-.02+0.05,.3,.06], ...
	     'BackgroundColor',[0.50 0.50 0.50]);
%pause;
% Then the text label
    
uicontrol( ...
	     'Style','text', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'Position',[vert+.615,hor-6*vys-.015+0.05,.14,.04], ...
        'BackgroundColor',[0.50 0.50 0.50], ...
	     'ForegroundColor',[1 1 1], ...
        'String','Set constant c');
    
cHndl=uicontrol('Style','edit', ...
        'Units','normalized', ...
        'Max',1, ...
        'Min',1, ...
        'BackgroundColor',[1 1 1], ...
        'Position',[vert+.76,hor-6*vys+0.04,.12,.045], ...
        'FontUnits','normalized',...
        'String','2',...%%%%
        'HorizontalAlignment','left'); 
    
 chih=uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.62,hor-8*vys+0.065,.13,.05], ...
         'Callback',['set(llchcv,''String'',''wait ...'');pause(.1);',...
         'c=str2num(get(cHndl,''string''));[h,g,hhch2,chcv2]=chll(x,y,n,k,m,c);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llchcv,''String'',CH);Inmat(8,2)=1;Inp(8,2)=1;',...
         'set(llchcvz,''Enable'',''on'');set(llchcvset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Fourier');
         
llchcv=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.76,hor-9*vys+.065,.14,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llchcv',...
   'String','');
            
llchcvz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert+.62,hor-9*vys+.065,.13,.05], ...
          'Callback',['figure;plot(hhch2,chcv2,''r'');',...
          'title(''Fourier dependence on h for LL estimator'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');   
      
llchcvset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.84,hor-9*vys+.065,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llchcvset',...
   'String','');
            
%Plug-in frame     
uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',[vert+.55,hor-16*vys-.03+.23,.39,.19], ...
        'BackgroundColor',bcgcol);
     
uicontrol( ...
     	  'Style','text', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'BackgroundColor',bcgcol,...
        'Position',[vert+.56,hor-10*vys-.06-.11+.2,.37,.05], ...
        'FontSize',12,...
        'String','Plug-in');
pluginh=uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.62,hor-16*vys+.05+0.22,.13,.05], ...
         'Callback',['set(llplugin,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhplugin,fplugin]=plugin(x,y,n,k,m,1);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llplugin,''String'',CH);Inmat(12,1:4)=1;Inp(12,1:4)=1;',...
         'set(llpluginz,''Enable'',''on'');set(llpluginset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'String','Plug-in');
llplugin=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.76,hor-16*vys+.22,.13,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llplugin',...
   'String','');
            
llpluginz=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert+.62,hor-16*vys+0.22,.13,.05], ...
          'Callback',['figure;plot(hhplugin,fplugin,''r'');',...
          'title(''Plug-in dependence on h'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
      
llpluginset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.84,hor-16*vys+.22,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llpluginset',...
   'String','');
      
%MSE frame     
uicontrol( ...
        'Style','frame', ...
        'Units','normalized', ...
        'Position',[vert+.55,hor-16*vys-.03,.39,.22], ...
        'BackgroundColor',bcgcol);
     
uicontrol( ...
     	  'Style','text', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'BackgroundColor',bcgcol,...
        'Position',[vert+.56,hor-10*vys-.06-.11,.37,.04], ...
        'FontSize',12,...
        'String','MSE');
     
msewar=uicontrol( ...
     	  'Style','text', ...
        'Units','normalized', ...
        'FontUnits','normalized',...
        'BackgroundColor',bcgcol,...
        'Position',[vert+.56,hor-11*vys-.06-.1,.37,.04], ...
        'String','(Only for known regression function)');
     
mseh=uicontrol('Style','push','Units','normalized', ...
         'FontUnits','normalized',...
         'Position',[vert+.62,hor-16*vys+.035,.13,.05], ...
         'Callback',['set(llmse,''String'',''wait ...'');pause(.1);',...
         '[h,g,hhmse,fmse]=mse(x,y,f,''t'',n,k,m);',...
         'CH=char([''= '',num2str(g,3)],[''h = '',num2str(h,4)]);',...
         'set(llmse,''String'',CH);Inmat(10,1:4)=1;Inp(10,1:4)=1;',...
         'set(llmsez,''Enable'',''on'');set(llmseset,''Visible'',''on'');'],...   
         'BackgroundColor',[.5,0.5,0.5], ...
         'Enable','off',...
         'String','MSE');
      
if ff      
switch ~~exist('sym')
case {0}
   set(msewar,'String','No symbolic toolbox!','ForegroundColor','red');
case {1}
   set(mseh,'Enable','on');
end;
else
   set(msewar,'String','Unknown regression function!','ForegroundColor','red');
end;
      
llmse=uicontrol( ...
	'Style','text', ...
   'Units','normalized', ...
   'FontUnits','normalized',...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.76,hor-16*vys-.015,.13,.08], ...
   'HorizontalAlignment','left',...
   'Tag','llmse',...
   'String','');
            
llmsez=uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[vert+.62,hor-16*vys-.015,.13,.05], ...
          'Callback',['figure;plot(hhmse,fmse,''r'');',...
          'title(''MSE dependence on h'');'],...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','draw',...
          'Enable','off');       
     
llmseset=uicontrol( ...
	'Style','radiobutton', ...
   'FontUnits','normalized',...
   'Units','normalized', ...
   'BackgroundColor',bcgcol,...
   'Position',[vert+.84,hor-16*vys-.015,.04,.1], ...
   'Callback',callstr,...
   'Visible','off',...
   'Tag','llmseset',...
   'String','');
     
uicontrol('Style','push','Units','normalized', ...
          'FontUnits','normalized',...
          'Position',[.84,.05,.14,.08], ...
          'Callback','close;', ...
          'BackgroundColor',[.5,0.5,0.5], ...
          'String','Close');
       
objects=get(gcf,'children');
set(objects,'FontUnits','normalized');
%set(gcf,'Units','Normalized','Position',[0 0.0347 1.0000 0.9190]);
set(gcf,'Units','Normalized','Position',[0.1059 0.1655 0.7700 0.6898]);
 


